import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'


import login from '../views/login.vue'
import register from '../views/register.vue'
import shops_register from '../views/shops_register.vue'


// 顾客
import userinfo from '../components/users/userinfo.vue'
import address from '../components/users/address.vue'
import shopshow from '../components/users/shopshow.vue'
import index from '../components/users/index.vue'
import shops_info from '../components/users/shops_info.vue'
import check_order from '../components/users/check_order.vue'
import order from '../components/users/order.vue'
import order_show from '../components/users/order_show.vue'
import order_details from '../components/users/order_details.vue'
import comment from '../components/users/comment.vue'
import chat from '../components/users/chat.vue'
import user_chat from '../components/users/user_chat.vue'


// 商家
import shops_index from '../components/shops/index.vue'
import shops_userinfo from '../components/shops/userinfo.vue'
import shops_goodshow from '../components/shops/goodshow.vue'
import shops_goodstype from '../components/shops/goodstype.vue'
import shops_order from '../components/shops/order.vue'
import shops_order_show from '../components/shops/goodshow.vue'
import shops_order_details from '../components/shops/order_details.vue'
import shops_chat from '../components/shops/shops_chat.vue'
import chats from '../components/shops/chat.vue'


// 骑手
import send_index from '../components/send/index.vue'
import send_order from '../components/send/send_order.vue'
import send_chat from '../components/send/send_chat.vue'
import send_userinfo from '../components/send/send_userinfo.vue'


// 平台
import tarrace_index from '../components/tarrace/index.vue'
import tarrace_send_show from '../components/tarrace/send_show.vue'
import tarrace_shops_show from '../components/tarrace/shops_show.vue'
import tarrace_userinfo from '../components/tarrace/tarrace_userinfo.vue'

var routes = [
  // 登录
  {
    path: '/',
    name: 'login',
    component: login,
  },
  // 注册
  {
    path: '/register',
    name: 'register',
    component: register,
  },
  // 商家注册
  {
    path: '/shops_register',
    name: 'shops_register',
    component: shops_register,
  },

  // 顾客地址
  {
    path: '/address',
    name: 'address',
    component: address,
  },
  // 顾客首页
  {
    path: '/index',
    name: 'index',
    component: index,
    children: [
      // 展示全部商家
      {
        path: '',
        name: 'shopshow',
        component: shopshow
      },
      // 聊天
      {
        path: 'user_chat',
        name: 'user_chat',
        component: user_chat
      },
      // 展示订单
      {
        path: 'order',
        name: 'order',
        component: order
      },
      // 顾客信息
      {
        path: 'userinfo',
        name: 'userinfo',
        component: userinfo,
      },
    ]
  },
  // 商家详情
  {
    path: '/shops_info',
    name: 'shops_info',
    component: shops_info,
  },
  // 支付
  {
    path: '/check_order',
    name: 'check_order',
    component: check_order,
  },
  // 展示订单
  {
    path: '/order_show',
    name: 'order_show',
    component: order_show,
  },
  // 展示订单详情
  {
    path: '/order_details',
    name: 'order_details',
    component: order_details
  },
  // 展示评论
  {
    path: '/comment',
    name: 'comment',
    component: comment
  },
  // 消息
  {
    path: '/chat',
    name: 'chat',
    component: chat
  },


  // 商家首页
  {
    path: '/shops_index',
    name: 'shops_index',
    component: shops_index,
    children: [
      // 商家菜品分类管理
      {
        path: '',
        name: 'shops_goodstype',
        component: shops_goodstype
      },
      // 商家菜品管理
      {
        path: 'shops_goodshow',
        name: 'shops_goodshow',
        component: shops_goodshow
      },
      // 聊天
      {
        path :'shops_chat',
        name: 'shops_chat',
        component: shops_chat,
      },
      // 订单信息
      {
        path: 'shops_order',
        name: 'shops_order',
        component: shops_order
      },
      // 商家信息
      {
        path: 'shops_userinfo',
        name: 'shops_userinfo',
        component: shops_userinfo,
      },
    ]
  },
  // 所有订单
  {
    path: '/shops_order_show',
    name: 'shops_order_show',
    component: shops_order_show,
  },
  // 订单详情
  {
    path: '/shops_order_details',
    name: 'shops_order_details',
    component: shops_order_details,
  },
  // 聊天
  {
    path: '/chats',
    name: 'chats',
    component: chats
  },


  // 骑手
  {
    path:'/send_index',
    name: 'send_index',
    component: send_index,
    children: [
      // 抢单
      {
        path: '',
        name: 'send_order',
        component: send_order,
      },
      // 聊天
      {
        path: '',
        name: 'send_chat',
        component: send_chat,
      },
      // 个人信息
      {
        path: 'send_userinfo',
        name: 'send_userinfo',
        component: send_userinfo,
      },
    ]
  },


  // 平台
  {
    path: '/tarrace_index',
    name: 'tarrace_index',
    component: tarrace_index,
    children: [
      // 所有骑手
      {
        path: 'tarrace_send_show',
        name: 'tarrace_send_show',
        component: tarrace_send_show,
      },
      // 所有商家
      {
        path: '',
        name: 'tarrace_shops_show',
        component: tarrace_shops_show,
      },
      // 平台信息
      {
        path: 'tarrace_userinfo',
        name: 'tarrace_userinfo',
        component: tarrace_userinfo,
      },
    ]
  },
]


const router = new createRouter({
  history: createWebHistory(), // history为必填项
  //history:createWebHashHistory(),
  routes,
})

export {
  router
}
